package com.titar.robot.ui.store;

import android.os.Bundle;
import android.view.View;

import com.titar.robot.R;
import com.titar.robot.base.BaseActivity;
import com.titar.robot.utils.ToastUtils;
import com.titar.robot.widgets.SmoothCheckBox;
import com.titar.robot.widgets.TntToolbar;

import java.util.ArrayList;
import java.util.List;

import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

public class StoreActivity extends BaseActivity {

    private TntToolbar tnt_toolbar;

    @Override
    protected void onInitWidget(Bundle savedInstanceState) {
        tnt_toolbar = findViewById(R.id.tnt_toolbar);
        tnt_toolbar.getCb_iv().setVisibility(View.VISIBLE);
        tnt_toolbar.getCheckBox().setVisibility(View.VISIBLE);
        tnt_toolbar.getCb_tv().setVisibility(View.VISIBLE);
        tnt_toolbar.getCb_tv2().setVisibility(View.VISIBLE);
        tnt_toolbar.getCb_iv().setImageResource(R.drawable.ic_launcher_background);
        tnt_toolbar.getCb_tv().setText(R.string.no_belong);
        tnt_toolbar.getCb_tv2().setText(4444+"");


        lists = new ArrayList<>();
        for (int i = 0; i < 20.; i++) {
            lists.add("--" + i);
        }
        store_recycle = findViewById(R.id.store_recycle);
        store_recycle.setLayoutManager(new GridLayoutManager(StoreActivity.this, 5));
        adapter = new StoreAdapter(StoreActivity.this, lists);
        store_recycle.setAdapter(adapter);
    }

    @Override
    protected void onInitListener() {
        tnt_toolbar.getCheckBox().setOnCheckedChangeListener(new SmoothCheckBox.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(SmoothCheckBox checkBox, boolean isChecked) {
                ToastUtils.showToast(isChecked+"------------------");
            }
        });
    }

    @Override
    public int getContentViewId() {
        return R.layout.layout_store_activity;
    }

    private RecyclerView store_recycle;

    private StoreAdapter adapter;
    private List<String> lists;

}
